﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.franchise.display {
    import flash.events.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.*;
    import Classes.util.*;
    import __AS3__.vec.*;
    import flash.filters.*;
    import org.aswing.geom.*;
    import Display.*;
    import Classes.doobers.*;
    import flash.text.*;
    import org.aswing.event.*;
    import org.aswing.border.*;
    import Modules.franchise.data.*;
    import Display.hud.components.*;
    import com.zynga.skelly.util.color.*;
    import Display.aswingui.*;
    import Display.hud.*;
    import Modules.franchise.transactions.*;

    public class FranchiseMenuUI extends JPanel {

        private static const ROW_HEIGHT:int = 59;
        private static const ROW_WIDTH:int = 659;
        private static const BUTTON_HEIGHT:int = 35;
        private static const BUTTON_WIDTH:int = 165;
        private static const TIMER_HEIGHT:int = 50;
        private static const TIMER_WIDTH:int = 165;
        private static const ROW_COUNT_MODULO:int = 4;

        private static var m_remindList:Array;
        public static var m_assetDict:Dictionary;

        protected var m_franchise:FranchiseMenu;
        protected var m_selected:OwnedFranchiseData;
        private var m_topPanel:JPanel;
        private var m_menuButtonPanel:JPanel;
        private var m_titlePanel:JPanel;
        private var m_infoPanel:JPanel;
        private var m_infoButton:CustomButton;
        private var m_tabShelf:FranchiseTabScrollingList;
        private var m_cardShelf:FranchiseCardScrollingList;
        private var m_ruleHorizPanel:JPanel;
        private var m_tabScrollerPanel:JPanel;
        private var m_cardScrollerPanel:JPanel;
        private var bgAsset:DisplayObject;
        private var m_tabItems:Array;
        private var m_nextCollectTimer:Timer;
        private var m_nextCollectText:JLabel;
        private var m_secondsLeft:Number = 86400;
        private var m_lastTimeCheck:Number;
        protected var m_comObject:Object;
        private var m_model:FranchiseDataModel;

        public function FranchiseMenuUI(){
            super(new SoftBoxLayout(SoftBoxLayout.Y_AXIS, -3, SoftBoxLayout.TOP));
            m_assetDict = new Dictionary(true);
            Global.delayedAssets.get(DelayedAssetLoader.FRANCHISE_ASSETS, this.makeFrAssets);
            Global.delayedAssets.get("assets/dialogs/InventoryAssets.swf", this.makeAssets);
            this.makeBackground();
        }
        private static function isFriendInRemindList(_arg1:String):Boolean{
            var _local4:Array;
            var _local2 = "";
            var _local3:int;
            while (_local3 < m_remindList.length) {
                _local2 = m_remindList[_local3];
                _local4 = _local2.split(":");
                if (_local4.length == 2){
                    if (_local4[1] == _arg1){
                        return (true);
                    };
                };
                _local3++;
            };
            return (false);
        }
        public static function addFriendReminder(_arg1:String, _arg2:String):void{
            if (isFriendInRemindList(_arg2)){
                return;
            };
            var _local3:Business = Global.franchiseManager.getBusinessFromType(FranchiseMenu.selectedFranchise.franchiseType);
            FranchiseViralManager.triggerFranchiseViralFeeds(FranchiseViralManager.VIRAL_REMINDERACCEPTBONUS, _arg1, _arg2, null, 0, _local3);
            m_remindList.push(((_arg1 + ":") + _arg2));
        }

        public function init(_arg1:FranchiseMenu, _arg2:OwnedFranchiseData):void{
            this.m_franchise = _arg1;
            this.m_selected = _arg2;
            this.m_model = Global.franchiseManager.model;
            this.initArrays();
            this.m_topPanel = new JPanel(new BorderLayout());
            this.m_tabScrollerPanel = new JPanel(new BorderLayout());
            this.m_cardScrollerPanel = new JPanel(new BorderLayout());
            this.m_infoPanel = new JPanel(new BorderLayout());
            this.m_ruleHorizPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            m_remindList = new Array();
            this.makeTopPanel();
            this.append(ASwingHelper.verticalStrut(9));
            this.makeTabPanel(FranchiseTabScrollingList.NUM_ITEMS);
            this.makeInfoPanel();
            this.makeRuleHorizPanel();
            this.makeCardPanel();
        }
        protected function makeFrAssets(_arg1:DisplayObject, _arg2:String):void{
            this.m_comObject = _arg1;
            FranchiseMenuUI.m_assetDict["fr_up_normal"] = this.m_comObject.fr_up_normal;
            FranchiseMenuUI.m_assetDict["fr_up_down"] = this.m_comObject.fr_up_down;
            FranchiseMenuUI.m_assetDict["fr_up_over"] = this.m_comObject.fr_up_over;
            FranchiseMenuUI.m_assetDict["fr_down_normal"] = this.m_comObject.fr_down_normal;
            FranchiseMenuUI.m_assetDict["fr_down_down"] = this.m_comObject.fr_down_down;
            FranchiseMenuUI.m_assetDict["fr_down_over"] = this.m_comObject.fr_down_over;
            FranchiseMenuUI.m_assetDict["fr_prev_normal"] = this.m_comObject.fr_prev_normal;
            FranchiseMenuUI.m_assetDict["fr_prev_down"] = this.m_comObject.fr_prev_down;
            FranchiseMenuUI.m_assetDict["fr_prev_over"] = this.m_comObject.fr_prev_over;
            FranchiseMenuUI.m_assetDict["fr_next_normal"] = this.m_comObject.fr_next_normal;
            FranchiseMenuUI.m_assetDict["fr_next_down"] = this.m_comObject.fr_next_down;
            FranchiseMenuUI.m_assetDict["fr_next_over"] = this.m_comObject.fr_next_over;
            FranchiseMenuUI.m_assetDict["fr_star_empty"] = this.m_comObject.fr_star_empty;
            FranchiseMenuUI.m_assetDict["fr_star_full"] = this.m_comObject.fr_star_full;
            FranchiseMenuUI.m_assetDict["fr_star_disabled"] = this.m_comObject.fr_star_disabled;
            FranchiseMenuUI.m_assetDict["fr_row_top"] = this.m_comObject.fr_row_top;
            FranchiseMenuUI.m_assetDict["fr_row_mid"] = this.m_comObject.fr_row_mid;
            FranchiseMenuUI.m_assetDict["fr_row_bot"] = this.m_comObject.fr_row_bot;
            FranchiseMenuUI.m_assetDict["fr_background"] = this.m_comObject.fr_background;
            FranchiseMenuUI.m_assetDict["fr_ruleH"] = this.m_comObject.fr_ruleH;
            FranchiseMenuUI.m_assetDict["fr_rule"] = this.m_comObject.fr_rule;
            FranchiseMenuUI.m_assetDict["fr_tab_normal_new"] = this.m_comObject.fr_tab_normal_new;
            FranchiseMenuUI.m_assetDict["fr_tab_normalNewFranchise_new"] = this.m_comObject.fr_tab_normalNewFranchise_new;
            FranchiseMenuUI.m_assetDict["fr_tab_selected_new"] = this.m_comObject.fr_tab_selected_new;
        }
        protected function makeAssets(_arg1:DisplayObject, _arg2:String):void{
            this.m_comObject = _arg1;
            FranchiseMenuUI.m_assetDict["btn_close_big_up"] = this.m_comObject.btn_close_big_up;
            FranchiseMenuUI.m_assetDict["btn_close_big_over"] = this.m_comObject.btn_close_big_over;
            FranchiseMenuUI.m_assetDict["btn_close_big_down"] = this.m_comObject.btn_close_big_down;
        }
        protected function initArrays():void{
            var _local2:OwnedFranchiseData;
            var _local1:Vector.<OwnedFranchiseData> = Global.franchiseManager.getAllFranchises();
            this.m_tabItems = [];
            for each (_local2 in _local1) {
                if (_local2.getLocationCount() > 0){
                    this.m_tabItems.push(_local2);
                };
            };
        }
        protected function makeBackground():void{
            this.bgAsset = (new (FranchiseMenuUI.m_assetDict["fr_background"])() as DisplayObject);
            var _local1:MarginBackground = new MarginBackground(this.bgAsset, new Insets(0, 0, 0, 0));
            this.setBackgroundDecorator(_local1);
            this.setPreferredSize(new IntDimension(this.bgAsset.width, this.bgAsset.height));
        }
        protected function makeTopPanel():void{
            this.m_topPanel.setBorder(new EmptyBorder(null, new Insets(0, 35, 0, 0)));
            this.m_titlePanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local2:String = ZLoc.t("Dialogs", "FranchiseTitle");
            var _local3:JTextField = ASwingHelper.makeTextField(_local2, EmbeddedArt.TITLE_FONT, 30, 16508714);
            _local3.filters = [new GlowFilter(33724, 1, 2, 2, 10), new DropShadowFilter(4, 45, 2446451, 1, 0, 0, 1)];
            var _local4:TextFormat = new TextFormat();
            _local4.size = 40;
            TextFieldUtil.formatSmallCaps(_local3.getTextField(), _local4);
            _local1.append(_local3);
            this.m_titlePanel.append(ASwingHelper.verticalStrut(9));
            this.m_titlePanel.append(_local1, BorderLayout.SOUTH);
            ASwingHelper.prepare(this.m_titlePanel);
            this.m_menuButtonPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            this.m_menuButtonPanel.setBorder(new EmptyBorder(null, new Insets(17, 0, 0, 17)));
            var _local5:JButton = new JButton();
            var _local6:DisplayObject = (new (FranchiseMenuUI.m_assetDict["btn_close_big_up"])() as DisplayObject);
            var _local7:DisplayObject = (new (FranchiseMenuUI.m_assetDict["btn_close_big_down"])() as DisplayObject);
            var _local8:DisplayObject = (new (FranchiseMenuUI.m_assetDict["btn_close_big_over"])() as DisplayObject);
            _local5.wrapSimpleButton(new SimpleButton(_local6, _local8, _local7, _local6));
            _local5.addActionListener(this.closeFranchise, 0, true);
            this.m_menuButtonPanel.appendAll(_local5);
            this.m_topPanel.append(this.m_titlePanel, BorderLayout.CENTER);
            this.m_topPanel.append(this.m_menuButtonPanel, BorderLayout.EAST);
            this.m_topPanel.setPreferredHeight(72);
            this.m_topPanel.setMinimumHeight(72);
            this.m_topPanel.setMaximumHeight(72);
            ASwingHelper.prepare(this.m_topPanel);
            this.append(this.m_topPanel);
            ASwingHelper.prepare(this);
        }
        protected function makeTabPanel(_arg1:int):void{
            this.m_tabScrollerPanel.removeAll();
            this.m_tabScrollerPanel.setBorder(new EmptyBorder(null, new Insets(0, 0, 0, 0)));
            this.m_tabScrollerPanel.setPreferredHeight(122);
            this.m_tabShelf = new FranchiseTabScrollingList(this.m_tabItems, FranchiseTabFactory, 0, 6, 1, _arg1);
            ASwingHelper.prepare(this.m_tabShelf);
            this.m_tabScrollerPanel.append(ASwingHelper.verticalStrut(5), BorderLayout.NORTH);
            this.m_tabScrollerPanel.append(this.m_tabShelf, BorderLayout.CENTER);
            ASwingHelper.prepare(this.m_tabScrollerPanel);
            this.append(this.m_tabScrollerPanel);
            ASwingHelper.prepare(this);
        }
        protected function makeInfoPanel():void{
            var _local3:JLabel;
            var _local4:JPanel;
            var _local5:JLabel;
            var _local6:int;
            var _local7:int;
            var _local8:Number;
            var _local9:Number;
            var _local10:String;
            var _local11:String;
            var _local12:Number;
            var _local13:AssetPane;
            this.m_infoPanel.removeAll();
            this.m_infoPanel.setBorder(new EmptyBorder(null, new Insets(0, 0, 0, 0)));
            this.m_infoPanel.setPreferredSize(new IntDimension(ROW_WIDTH, 59));
            this.m_infoPanel.setMinimumSize(new IntDimension(ROW_WIDTH, 59));
            this.m_infoPanel.setMaximumSize(new IntDimension(ROW_WIDTH, 59));
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            if (FranchiseMenu.selectedFranchise.dailyBonusAvailable){
                this.m_infoButton = new CustomButton(ZLoc.t("Dialogs", "Collect").toUpperCase(), null, "GreenButtonUI");
                this.m_infoButton.setPreferredSize(new IntDimension((BUTTON_WIDTH - 4), BUTTON_HEIGHT));
                this.m_infoButton.setMinimumSize(new IntDimension((BUTTON_WIDTH - 4), BUTTON_HEIGHT));
                this.m_infoButton.setMaximumSize(new IntDimension((BUTTON_WIDTH - 4), BUTTON_HEIGHT));
                this.m_infoButton.addEventListener(MouseEvent.CLICK, this.onCollectClick, false, 0, true);
                _local1.setBorder(new EmptyBorder(null, new Insets(13, 0, 0, 0)));
                _local1.appendAll(ASwingHelper.horizontalStrut(3), this.m_infoButton, ASwingHelper.horizontalStrut(3));
                _local1.append(ASwingHelper.horizontalStrut(80));
                ASwingHelper.prepare(_local1);
                this.m_infoButton.setEnabled(!(Global.franchiseManager.isPendingFranchise(FranchiseMenu.selectedFranchise.franchiseType)));
                _local3 = new JLabel(ZLoc.t("Dialogs", "DailyBonusCall"));
                _local3.setForeground(new ASColor(FranchiseMenu.COLOR_MENU_STANDARD));
                _local3.setFont(ASwingHelper.getBoldFont(16));
                _local2.append(ASwingHelper.horizontalStrut(40));
                _local2.append(_local3);
                ASwingHelper.prepare(_local2);
            } else {
                _local4 = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
                _local5 = new JLabel(ZLoc.t("Dialogs", "CollectIn"));
                _local5.setForeground(new ASColor(FranchiseMenu.COLOR_MENU_STANDARD));
                _local5.setFont(ASwingHelper.getBoldFont(16));
                _local4.setPreferredSize(new IntDimension(TIMER_WIDTH, TIMER_HEIGHT));
                _local4.setMinimumSize(new IntDimension(TIMER_WIDTH, TIMER_HEIGHT));
                _local4.setMaximumSize(new IntDimension(TIMER_WIDTH, TIMER_HEIGHT));
                this.m_nextCollectText = new JLabel(" ");
                this.m_nextCollectText.setForeground(new ASColor(FranchiseMenu.COLOR_MENU_STANDARD));
                this.m_nextCollectText.setFont(ASwingHelper.getBoldFont(16));
                _local4.appendAll(_local5, this.m_nextCollectText);
                _local1.append(_local4);
                _local1.append(ASwingHelper.horizontalStrut(85));
                this.m_nextCollectTimer = new Timer(958);
                this.m_nextCollectTimer.addEventListener(TimerEvent.TIMER, this.updateCollectTimer);
                this.m_nextCollectTimer.start();
                ASwingHelper.prepare(_local1);
                _local6 = 1;
                _local7 = 0;
                while (_local7 < this.m_tabItems.length) {
                    if ((this.m_tabItems[_local7] as OwnedFranchiseData).franchiseType == FranchiseMenu.selectedFranchise.franchiseType){
                        _local6 = (_local7 + 1);
                        break;
                    };
                    _local7++;
                };
                _local6 = Math.min(4, _local6);
                _local8 = Global.gameSettings.getNumber((("franchise" + _local6.toString()) + "DailyBonus"));
                _local9 = this.m_model.getFranchiseCountByType(FranchiseMenu.selectedFranchise.franchiseType);
                _local10 = this.m_model.getFranchiseName(FranchiseMenu.selectedFranchise.franchiseType);
                _local11 = ZLoc.t("Dialogs", "DailyBonusInfo", {
                    amount:_local8,
                    business:_local10
                });
                _local12 = 360;
                _local13 = ASwingHelper.makeMultilineText((_local11 + " "), _local12, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.LEFT, 16, FranchiseMenu.COLOR_MENU_STANDARD);
                _local13.setVerticalAlignment(JLabel.CENTER);
                _local2.append(ASwingHelper.horizontalStrut(30));
                _local2.appendAll(_local13);
                ASwingHelper.prepare(_local2);
            };
            this.m_infoPanel.append(_local1, BorderLayout.EAST);
            this.m_infoPanel.append(_local2, BorderLayout.CENTER);
            ASwingHelper.prepare(this.m_infoPanel);
            this.append(this.m_infoPanel);
            ASwingHelper.prepare(this);
        }
        public function updateCollectTimer(_arg1:TimerEvent):void{
            var _local2:int;
            if (!FranchiseMenu.selectedFranchise.dailyBonusAvailable){
                _local2 = int(((FranchiseMenu.selectedFranchise.dailyBonusLastCollect + FranchiseMenu.dailyCycleDelta) - (GlobalEngine.getTimer() / 1000)));
                if (_local2 <= 0){
                    this.m_nextCollectText.visible = false;
                    this.m_nextCollectText.setText("");
                    FranchiseMenu.selectedFranchise.dailyBonusAvailable = true;
                    this.switchBusiness(FranchiseMenu.selectedFranchise.franchiseType);
                } else {
                    this.m_nextCollectText.visible = true;
                    this.m_nextCollectText.setText(GameUtil.formatMinutesSeconds(((_local2 * 86400) / Global.gameSettings.inGameDaySeconds)));
                };
            } else {
                this.m_nextCollectText.visible = false;
                this.m_nextCollectText.setText("");
            };
        }
        protected function makeRuleHorizPanel():void{
            this.m_ruleHorizPanel.removeAll();
            var _local1:DisplayObject = (new (FranchiseMenuUI.m_assetDict["fr_ruleH"])() as DisplayObject);
            var _local2:AssetPane = new AssetPane(_local1);
            var _local3:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            ASwingHelper.prepare(_local2);
            _local3.append(_local2);
            this.m_ruleHorizPanel.appendAll(ASwingHelper.verticalStrut(6), _local3, ASwingHelper.verticalStrut(3));
            this.append(this.m_ruleHorizPanel);
        }
        protected function makeCardPanel():void{
            var _local1:Vector.<FranchiseExpansionData>;
            this.m_cardScrollerPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            if (FranchiseMenu.selectedFranchise){
                _local1 = Global.franchiseManager.getAllFranchisesByType(FranchiseMenu.selectedFranchise.franchiseType);
            } else {
                _local1 = new Vector.<FranchiseExpansionData>();
            };
            this.addDisabledRow(_local1);
            this.completeEmptyRows(_local1);
            this.m_cardShelf = new FranchiseCardScrollingList(GameUtil.vectorToArray(_local1), FranchiseCardFactory, 0, 1, 4);
            ASwingHelper.prepare(this.m_cardShelf);
            this.m_cardScrollerPanel.append(this.m_cardShelf);
            this.append(this.m_cardScrollerPanel);
            ASwingHelper.prepare(this);
        }
        private function addDisabledRow(_arg1:Vector.<FranchiseExpansionData>):void{
            var _local2:FranchiseExpansionData = FranchiseExpansionData.loadDummyObject(StarRatingComponent.DISABLED);
            _arg1.push(_local2);
        }
        private function addEmptyRow(_arg1:Vector.<FranchiseExpansionData>):void{
            var _local2:FranchiseExpansionData = FranchiseExpansionData.loadDummyObject(StarRatingComponent.NONE);
            _arg1.push(_local2);
        }
        private function completeEmptyRows(_arg1:Vector.<FranchiseExpansionData>):void{
            while ((_arg1.length % ROW_COUNT_MODULO) != 0) {
                this.addEmptyRow(_arg1);
            };
        }
        public function switchBusiness(_arg1:String):void{
            FranchiseMenu.selectedFranchise = Global.franchiseManager.getFranchise(_arg1);
            this.initArrays();
            this.makeInfoPanel();
            this.makeRuleHorizPanel();
            if (this.m_cardShelf){
                this.remove(this.m_cardScrollerPanel);
                this.m_cardScrollerPanel.remove(this.m_cardShelf);
                this.makeCardPanel();
            };
            this.m_tabShelf.setSelected(_arg1);
        }
        public function refreshMenuUI():void{
            this.switchBusiness(FranchiseMenu.selectedFranchise.franchiseType);
        }
        protected function onCollectClick(_arg1:MouseEvent):void{
            var _local2:int;
            var _local3:int;
            var _local4:Number;
            if (FranchiseMenu.selectedFranchise.dailyBonusAvailable){
                Global.franchiseManager.collectDailyBonus(FranchiseMenu.selectedFranchise.franchiseType);
                Sounds.play("Collect");
                GameTransactionManager.addTransaction(new TFranchiseDailyBonus(FranchiseMenu.selectedFranchise.franchiseType));
                _local2 = 1;
                _local3 = 0;
                while (_local3 < this.m_tabItems.length) {
                    if ((this.m_tabItems[_local3] as OwnedFranchiseData).franchiseType == FranchiseMenu.selectedFranchise.franchiseType){
                        _local2 = (_local3 + 1);
                        break;
                    };
                    _local3++;
                };
                _local2 = Math.min(4, _local2);
                _local4 = (this.m_model.getFranchiseCountByType(FranchiseMenu.selectedFranchise.franchiseType) * Global.gameSettings.getNumber((("franchise" + _local2.toString()) + "DailyBonus")));
                Global.player.gold = (Global.player.gold + _local4);
                this.doCoinFlyout(_local4, _arg1.stageX, _arg1.stageY);
                this.doSendSaleDoobers(_local4, _arg1.stageX, _arg1.stageY, false);
                this.switchBusiness(FranchiseMenu.selectedFranchise.franchiseType);
            };
        }
        protected function onCloseDown(_arg1:MouseEvent):void{
            _arg1.stopImmediatePropagation();
            _arg1.stopPropagation();
        }
        protected function onCloseOver(_arg1:MouseEvent):void{
            var _local2:ColorMatrix = new ColorMatrix();
            _local2.adjustBrightness(1.5, 1.5, 1.5);
            _local2.adjustContrast(1.5, 1.5, 1.5);
            (_arg1.target as JButton).filters = [_local2.filter];
        }
        protected function onCloseOut(_arg1:MouseEvent):void{
            (_arg1.target as JButton).filters = [];
        }
        protected function closeFranchise(_arg1:AWEvent):void{
            if (m_remindList.length > 0){
                m_remindList.splice(0, m_remindList.length);
            };
            this.m_franchise.close();
        }
        public function get tabShelf():FranchiseTabScrollingList{
            return (this.m_tabShelf);
        }
        public function doCoinFlyout(_arg1:Number, _arg2:int, _arg3:int):void{
            var _local4:String = ZLoc.t("Main", "GainCoins", {coins:_arg1});
            var _local5:* = new EmbeddedArt.smallCoinIcon();
            UI.displayStatus(_local4, _arg2, _arg3, _local5);
        }
        public function doSendSaleFlyout(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
            var _local5:String = ZLoc.t("Main", "SendSale", {
                coins:_arg1,
                bonus:_arg2
            });
            _local5 = (("<font color='#008C46'>" + _local5) + "</font>");
            var _local6:DisplayObject = new EmbeddedArt.smallCoinIcon();
            UI.displayStatus(_local5, _arg3, _arg4, _local6);
        }
        public function doSendSaleDoobers(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=true):void{
            var _local5:HUDComponent = Global.hud.getComponent(HUD.COMP_COINS);
            var _local6:Point = Global.hud.localToGlobal(new Point(_local5.x, _local5.y));
            var _local7:HUDComponent = Global.hud.getComponent(HUD.COMP_ENERGY);
            var _local8:Point = Global.hud.localToGlobal(new Point(_local7.x, _local7.y));
            var _local9:String = Global.gameSettings.getDooberFromType(Doober.DOOBER_COIN, 10);
            var _local10:Point = new Point(_arg2, _arg3);
            var _local11:int = this.getDooberCountFromCoins(_arg1);
            while (_local11 > 1) {
                setTimeout(Global.world.dooberManager.createDummyDoober, 200, _local9, _local10, _local6);
                if (_arg4){
                    setTimeout(Global.world.dooberManager.createDummyDoober, 200, Global.gameSettings.getDooberFromType(Doober.DOOBER_ENERGY, 5), _local10, _local8);
                };
                _local11--;
            };
            if (_local11 == 1){
                Global.world.dooberManager.createDummyDoober(_local9, _local10, _local6);
                if (_arg4){
                    Global.world.dooberManager.createDummyDoober(Global.gameSettings.getDooberFromType(Doober.DOOBER_ENERGY, 5), _local10, _local8);
                };
            };
        }
        private function getDooberCountFromCoins(_arg1:Number):int{
            var _local2:int = ((_arg1 / 50) + 1);
            return (_local2);
        }

    }
}//package Modules.franchise.display 
